﻿using Microsoft.Extensions.DependencyInjection;

namespace ZeroSum.DependencyInjection.Attributes;

/// <summary>
///     依赖注入注册
/// </summary>
[AttributeUsage(AttributeTargets.Class)]
public class RegisterAttribute : Attribute
{
    /// <summary>
    ///     初始化一个<see cref="RegisterAttribute" />类型的新实例
    /// </summary>
    public RegisterAttribute(ServiceLifetime lifetime)
    {
        Lifetime = lifetime;
    }

    public RegisterAttribute()
    {
    }

    /// <summary>
    ///     获取 生命周期类型，代替
    /// </summary>
    public ServiceLifetime? Lifetime { get; }
}